﻿@model X.PagedList.IPagedList<WoodAdmin.Models.SysGroup>
@{
    var searchModel = (ViewBag.SearchModel as SysGroup) ?? new SysGroup();
}
<div class="layui-form">
    <blockquote class="layui-elem-quote quoteBox">
        <form class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="Name" class="layui-input searchVal" placeholder="组名/英文名" value="@searchModel.Name" />
                </div>
                <input type="submit" value="搜索" class="layui-btn search_btn" />
            </div>
            <div class="layui-inline">
                <input type="button" value="添加" onclick="editModel('/SysGroup/AddEdit')" class="layui-btn">
            </div>
        </form>
    </blockquote>
    <table class="layui-table">
        <thead>
            <tr>
                <th>组名</th>
                <th>英文名</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr>
                    <td colspan="4" align="center">@APPKeys.NoData</td>
                </tr>
            }
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.Title</td>
                    <td>@item.Name</td>
                    <td>@item.CreateTime.ToString("yyyy-MM-dd")</td>
                    <td>
                        @if (_service.ActionPermission("SysGroup", "AddEdit"))
                        {
                            <input type="button" value="编辑" onclick="editModel('/SysGroup/AddEdit/@item.ID')" class="layui-btn layui-btn-primary layui-btn-sm">
                        }
                        @if (_service.ActionPermission("SysGroup", "Delete"))
                        {
                            <input type="button" value="删除" onclick="deleteModel('/SysGroup/Delete',@item.ID,'/SysGroup/Index')" class="layui-btn layui-btn-primary layui-btn-sm" />
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>
    @Html.PagedListPager(Model, page =>
            Url.Action("Index", new { page }),
            new PagedListRenderOptionsBase
            {
                LiElementClasses = new List<string> { "page-item" },
                PageClasses = new List<string> { "page-link" },
                LinkToLastPageFormat = "尾页",
                LinkToNextPageFormat = "下一页",
                LinkToPreviousPageFormat = "上一页",
                LinkToFirstPageFormat = "首页",
            })
</div>